export const configColor = (data: any) => {
  const ColorJson=[]
  for(let k in data['highlightConnection']){
    let par={
      "name": data['highlightConnection'][k],
      "stroke":"green",
      "fill":"green"
    }
    ColorJson.push(par)
  }
  for(let k in data['highlightElement']){
    let par={
      "name": data['highlightElement'][k],
      "stroke":"gray",
      "fill":"#eae9e9"

    }
    ColorJson.push(par)
  }
  for(let k in data['iDoElement']){
    let par={
      "name": data['iDoElement'][k],
      "stroke":"green",
      "fill":"#a3d68e"
    }
    ColorJson.push(par)
  }
  if (data['waitingToDoElement'].length>0) {
    for(let k in data['waitingToDoElement']){
      let par={
        "name": data['waitingToDoElement'][k],
        "stroke":"green",
        "fill":"yellow"
      }
      ColorJson.push(par)
    }
  }
  return ColorJson
}
export const renderColor = (json: any,bpmnModeler: any) => {
  let modeling = bpmnModeler.get('modeling');
  let elementRegistry = bpmnModeler.get('elementRegistry')
  let elementToColor = elementRegistry.get(json.name);
  if(elementToColor){
    modeling.setColor([elementToColor], {
      stroke: json.stroke,
      fill: json.fill
    });
  }
}
